package top.yihoxu.yapi.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author dth
 * @Date 2024/7/9 15:21
 * @PackageName:top.yihoxu.answer.config
 * @ClassName: OssClientConfig
 * @Description: 阿里云oss客户端
 * @Version 1.0
 */
@Configuration
@ConfigurationProperties(prefix = "oss.client")
@Data
public class OssClientConfig {
    /**
     * accessKey
     */
    private String accessKey;

    /**
     * secretKey
     */
    private String secretKey;

    /**
     * 区域
     */
    private String region;

    /**
     * 桶名
     */
    private String bucket;

    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(region, accessKey, secretKey);
    }
}
